/**
 *Project: jh-framework
 *File: cn.xkshow.util.regex.FieldValidation.java 
 *Author: hardy(admin@xkshow.cn) Copyright
 ****************************************************************
 *   VERSION       DATE            BY       CHANGE/COMMENT
 * --------------------------------------------------------------
 *    1.0        2013-7-11         hardy         create
 ****************************************************************
 *note:
 ***************************************************************/ 
package cn.xkshow.util.regex;

import java.util.regex.Pattern;

public class FieldValidation {
	
	/*
	 * Phone number verification
	 */
	public boolean isPhoneNo(String PhoneNo){
		if(isMobileNo(PhoneNo) || isTelePhoneNo(PhoneNo) || isPASNo(PhoneNo)){
			return true;
		}else{
			return false;
		}
	}
	//Mobile Number
	public boolean isMobileNo(String PhoneNo){
		if(Pattern.compile(ConstantRegex.REGEX_FieldValidation_MobileNo).matcher(PhoneNo).find()) {
			return true;
		}else{
			return false;
		}
	}
	//Telephone Number
	public boolean isTelePhoneNo(String PhoneNo){
		if(Pattern.compile(ConstantRegex.REGEX_FieldValidation_TPhoneNo).matcher(PhoneNo).find()) {
			return true;
		}else{
			return false;
		}
	}
	//PAS Number
	public boolean isPASNo(String PhoneNo){
		if(Pattern.compile(ConstantRegex.REGEX_FieldValidation_PASNo).matcher(PhoneNo).find()) {
			return true;
		}else{
			return false;
		}
	}
	
	/*
	 * Email verification
	 */
	public boolean isEmail(String email){
		if(Pattern.compile(ConstantRegex.REGEX_FieldValidation_Email).matcher(email).find()) {
			return true;
		}else{
			return false;
		}
	}
}
